feat(flask): Add span streaming support and request body capture#6264
feat(flask): Add span streaming support and request body capture#6264ericapisani wants to merge 7 commits into
Conversation
Add request body data to the streaming segment span when span streaming is enabled. Update existing tests to cover both streaming and non-streaming code paths, and add new tests for request body capture, size limits, and header scrubbing in streaming mode. Fixes PY-2323 Fixes #6021
|
bugbot run |
|
@sentry review |
Codecov Results 📊✅ 282 passed | Total: 282 | Pass Rate: 100% | Execution Time: 42.44s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 5.66%. Project has 14817 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 33.63% 33.57% -0.06%
==========================================
Files 190 190 —
Lines 22260 22304 +44
Branches 7536 7560 +24
==========================================
+ Hits 7485 7487 +2
- Misses 14775 14817 +42
- Partials 747 747 —Generated by Codecov Action |
| extractor = FlaskRequestExtractor(request) | ||
|
|
||
| if not request_body_within_bounds(client, content_length): | ||
| data = AnnotatedValue.substituted_because_over_size_limit() |
There was a problem hiding this comment.
This general logic mostly follows what happens with the request extractor, but Instead of removing the string entirely, it substitutes it with a value to explain why a value was removed, as opposed to providing only an empty string.
alexander-alderman-webb
left a comment
There was a problem hiding this comment.
I just looked at the request body attribute since I'm solving this in Starlette right now, and the same problem applies here 😅
… of just as the request is getting started
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b7c0ec6. Configure here.
Add span streaming support to the Flask integration. When span streaming is enabled via
_experiments={"trace_lifecycle": "stream"}, the integration now captures request body data as an attribute on the segment span.The request body handling respects existing size limits and content type rules — oversized bodies get the substitution marker, unparseable raw data gets annotated accordingly (different from what we do today where we remove the value entirely).
Fixes PY-2323
Fixes #6021